/**
 * RecordPlayerItem
 * @Author ace.ch
 * @Date 2018/3/27 20:28
 */
class RecordPlayerItem extends BaseSprite {

    head: HeadIcon;
    lab_nick: eui.Label;
    lab_score: eui.Label;

    constructor() {
        super();

        this.skinName = 'RecordPlayerItemSkin';
    }

    childrenCreated() {
        super.childrenCreated();

        this.clean();
    }

    update(data: any) {
        this.skinState = 'normal';

        this.head.src = '' + data.pic;
        this.head.isVip = data.hasOwnProperty('gid');
        this.head.isOwner = data.pos == 1;
        this.lab_nick.text = '' + data.nick;
    }

    clean() {
        this.skinState = 'empty';
    }

    set score(v: number) {
        this.lab_score.text = '' + v;
        this.lab_score.textColor = v > 0 ? 0xdd393b : 0x3c9cde;
    }
}